package com.fanwj.citrus.aidl.proxy;

import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.io.FileDescriptor;

public interface IBinderProxy extends IBinder {

    default boolean transact(int code, @NonNull Parcel data, @Nullable Parcel reply, int flags) throws RemoteException {
        throw new RemoteException();
    }

    default com.fanwj.citrus.aidl.android.os.IInterface queryLocalInterface(@NonNull String descriptor) {
        return null;
    }
    boolean transact(int code, @NonNull com.fanwj.citrus.aidl.android.os.Parcel data, com.fanwj.citrus.aidl.android.os.Parcel reply, int flags) throws com.fanwj.citrus.aidl.android.os.RemoteException;

    @Nullable
    default String getInterfaceDescriptor() throws RemoteException {
        return "";
    }

    default boolean pingBinder() {
        return false;
    }

    default boolean isBinderAlive() {
        return false;
    }

    default void dump(@NonNull FileDescriptor fd, @Nullable String[] args) throws RemoteException {
    }

    default void dumpAsync(@NonNull FileDescriptor fd, @Nullable String[] args) throws RemoteException {
    }

    default void linkToDeath(@NonNull DeathRecipient recipient, int flags) throws RemoteException {
    }

    default boolean unlinkToDeath(@NonNull DeathRecipient recipient, int flags) {
        return false;
    }
}
